﻿using Microsoft.Extensions.Configuration;
using MiniFox.Configurations;

namespace MiniFox.Components.Configurations
{
    /// <summary>
    /// 
    /// </summary>
    [Section(ELEMENT_NAME)]
    public class ComponentContainerConfiguration : IComponentContainerConfiguration
    {
        internal const string ELEMENT_NAME = "minifox:componentContainer";

        const string CONTAINER_TYPE = "containerType";
        const string COMPONENT_SETTINGS = "componentSettings";
        /// <summary>
        /// 
        /// </summary>
        public ComponentContainerConfiguration()
        {
            this.ContainerType = "MiniFox.Components.DefaultComponentContainer, MiniFox";
        }
        /// <summary>
        /// 
        /// </summary>
        [ConfigurationKeyName(CONTAINER_TYPE)]
        public string ContainerType
        {
            get;
            set;
        }

        /// <summary>
        /// 组件配置集合
        /// </summary>
        [ConfigurationKeyName(COMPONENT_SETTINGS)]
        public ComponentConfigCollection ComponentSettings
        {
            get;
            set;

        } = new();
        /// <summary>
        /// 
        /// </summary>
        IComponentConfigCollection IComponentContainerConfiguration.ComponentSettings
        {
            get
            {
                return this.ComponentSettings;
            }
        }
    }
}
